<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GdkPixbuf加载器(GdkPixbufLoader)</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK-PixBuf参考手册">
<link rel="up" href="rn01.html" title="API 参考">
<link rel="prev" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html" title="动画">
<link rel="next" href="gdk-pixbuf-Module-Interface.html" title="Module Interface">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK-PixBuf参考手册</th>
<td><a accesskey="n" href="gdk-pixbuf-Module-Interface.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GdkPixbufLoader.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GdkPixbufLoader.description" class="shortcut">Description</a>
                   | 
                  <a href="#GdkPixbufLoader.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#GdkPixbufLoader.signals" class="shortcut">Signals</a>
</td></tr>
</table>
<div class="refentry">
<a name="GdkPixbufLoader"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GdkPixbufLoader.top_of_page"></a>GdkPixbuf加载器(GdkPixbufLoader)</span></h2>
<p>GdkPixbuf加载器(GdkPixbufLoader) — 应用驱动先进图像加载。</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GdkPixbufLoader.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;

struct              <a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-struct" title="struct GdkPixbufLoader">GdkPixbufLoader</a>;
<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="returnvalue">GdkPixbufLoader</span></a> *     <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-new" title="gdk_pixbuf_loader_new ()">gdk_pixbuf_loader_new</a>             (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="returnvalue">GdkPixbufLoader</span></a> *     <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-new-with-type" title="gdk_pixbuf_loader_new_with_type ()">gdk_pixbuf_loader_new_with_type</a>   (<em class="parameter"><code>const <span class="type">char</span> *image_type</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="returnvalue">GdkPixbufLoader</span></a> *     <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-new-with-mime-type" title="gdk_pixbuf_loader_new_with_mime_type ()">gdk_pixbuf_loader_new_with_mime_type</a>
                                                        (<em class="parameter"><code>const <span class="type">char</span> *mime_type</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="returnvalue">GdkPixbufFormat</span></a> *   <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-get-format" title="gdk_pixbuf_loader_get_format ()">gdk_pixbuf_loader_get_format</a>        (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()">gdk_pixbuf_loader_write</a>             (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#guchar"><span class="type">guchar</span></a> *buf</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> count</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-set-size" title="gdk_pixbuf_loader_set_size ()">gdk_pixbuf_loader_set_size</a>          (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>);
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *           <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-get-pixbuf" title="gdk_pixbuf_loader_get_pixbuf ()">gdk_pixbuf_loader_get_pixbuf</a>      (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>);
<a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#GdkPixbufAnimation"><span class="returnvalue">GdkPixbufAnimation</span></a> *  <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-get-animation" title="gdk_pixbuf_loader_get_animation ()">gdk_pixbuf_loader_get_animation</a>   (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-close" title="gdk_pixbuf_loader_close ()">gdk_pixbuf_loader_close</a>             (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GdkPixbufLoader.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  <a href="../gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----GdkPixbufLoader
</pre>
</div>
<div class="refsect1">
<a name="GdkPixbufLoader.signals"></a><h2>Signals</h2>
<pre class="synopsis">
  "<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-area-prepared" title='The "area-prepared" signal'>area-prepared</a>"                                  : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
  "<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-area-updated" title='The "area-updated" signal'>area-updated</a>"                                   : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
  "<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-closed" title='The "closed" signal'>closed</a>"                                         : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
  "<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-size-prepared" title='The "size-prepared" signal'>size-prepared</a>"                                  : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
</pre>
</div>
<div class="refsect1">
<a name="GdkPixbufLoader.description"></a><h2>Description</h2>
<p>
<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> 提供了一种应用程序驱动加载图像过程的方法，该方法是通过
由应用程序直接向加载器发送图像数据来取代使加载器从文件读取数据的方式实现的。
应用程序可以使用这个功能来替代 <a class="link" href="gdk-pixbuf-%E5%8A%A0%E8%BD%BD%E6%96%87%E4%BB%B6(File-Loading).html#gdk-pixbuf-new-from-file" title="gdk_pixbuf_new_from_file"><code class="function">gdk_pixbuf_new_from_file()</code></a> 或
<a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#gdk-pixbuf-animation-new-from-file" title="gdk_pixbuf_animation_new_from_file"><code class="function">gdk_pixbuf_animation_new_from_file()</code></a> 来解析分成小块的数据。例如，它
可以被用来读取通过(可能)很慢的网络连接传递的图像数据，或者加载一个非常大的
文件。
</p>
<p>
使用 <a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> 来加载图像，只需要创建一个新的实例，然后调用
call <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()"><code class="function">gdk_pixbuf_loader_write()</code></a> 来将数据发送给它。当发送完了，调用
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-close" title="gdk_pixbuf_loader_close ()"><code class="function">gdk_pixbuf_loader_close()</code></a> 来结束数据流并完成所有的事。在整个过程中
加载器将发出三个重要的信号。第一个，"<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-size-prepared" title='The "size-prepared" signal'>size_prepared</a>"，
将在图像收到足够的信息来确定其大小的发出。如果需要在加载的时候缩放图像，
可以调用 <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-set-size" title="gdk_pixbuf_loader_set_size ()"><code class="function">gdk_pixbuf_loader_set_size()</code></a> 来响应这个信号。
</p>
<p>
第二个，"<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-area-prepared" title='The "area-prepared" signal'>area_prepared</a>"，
将在期望的 pixbuf 被分配完内存的时候发送。可以通过调用
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-get-pixbuf" title="gdk_pixbuf_loader_get_pixbuf ()"><code class="function">gdk_pixbuf_loader_get_pixbuf()</code></a>来取得该 pixbuf。简单的引用(ref)它便可以
使用。另外，现在还没有实际的数据传进来，所以如果需要，这个 pixbuf 可以被安全
的使用任何临时图像(或者一种初始颜色)进行填充。也可以在之后调用
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-get-pixbuf" title="gdk_pixbuf_loader_get_pixbuf ()"><code class="function">gdk_pixbuf_loader_get_pixbuf()</code></a> ，将得到同一个 pixbuf。
</p>
<p>
最后一个，"<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-area-updated" title='The "area-updated" signal'>area_updated</a>"，每当
有一个区域被更新时就发送一次。这样可以更新部分完成的图像。注意，你不能从
更新的区域得出这个完整图像的任何信息。例如，在一个交错的图像中，就需要在
图像完全加载之前进行多次传递。
</p>
<p>
</p>
<div class="refsect2">
<a name="id2854657"></a><h3>加载一个动画 (Loading an animation)</h3>
<p> 加载一个动画几乎和加载一个图像一样简单。
当第一个 "<a class="link" href="GdkPixbufLoader.html#GdkPixbufLoader-area-prepared" title='The "area-prepared" signal'>
area_prepared</a>" 信号被发送后，可以调用 <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-get-animation" title="gdk_pixbuf_loader_get_animation ()"><code class="function">gdk_pixbuf_loader_get_animation()</code></a>
来得到这个 <a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a> 结构，并调用 <a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#gdk-pixbuf-animation-get-iter" title="gdk_pixbuf_animation_get_iter ()"><code class="function">gdk_pixbuf_animation_get_iter()</code></a> 
来得到一个用来显示它的 <a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#GdkPixbufAnimationIter"><span class="type">GdkPixbufAnimationIter</span></a>。 </p>
</div>
<p>
</p>
</div>
<div class="refsect1">
<a name="GdkPixbufLoader.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdkPixbufLoader-struct"></a><h3>struct GdkPixbufLoader</h3>
<pre class="programlisting">struct GdkPixbufLoader;</pre>
<p>
The <span class="structname">GdkPixbufLoader</span> struct contains only private
fields.
</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-new"></a><h3>gdk_pixbuf_loader_new ()</h3>
<pre class="programlisting"><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="returnvalue">GdkPixbufLoader</span></a> *     gdk_pixbuf_loader_new             (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
创建一个新的 pixbuf 装载器(loader)对象
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>一个新的 pixbuf 装载器(loader).</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-new-with-type"></a><h3>gdk_pixbuf_loader_new_with_type ()</h3>
<pre class="programlisting"><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="returnvalue">GdkPixbufLoader</span></a> *     gdk_pixbuf_loader_new_with_type   (<em class="parameter"><code>const <span class="type">char</span> *image_type</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
创建一个新的 pixbuf loader 对象来解析图像数据，该数据将始终被假设为 
<em class="parameter"><code>image_type</code></em> 格式的图像数据，而不是自动判断图像格式。当如果希望当加载一个不能
通过查看数据来可靠确定的文件格式的文件时，如果该文件不是期望的格式便引发一个
错误时会有用，手工强制指定一个文件格式时也有用。
</p>
<p>
支持的图像格式列表依赖于安装了哪些图像加载器(image loader)，但典型的 "
png", "jpeg", "gif", "tiff" and "xpm" 
都是可支持的格式。可以通过为 <a class="link" href="gdk-pixbuf-Module-Interface.html#gdk-pixbuf-get-formats" title="gdk_pixbuf_get_formats ()"><code class="function">gdk_pixbuf_get_formats()</code></a> 所返回
的每个 <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="type">GdkPixbufFormat</span></a> 结构调用 <a class="link" href="gdk-pixbuf-Module-Interface.html#gdk-pixbuf-format-get-name" title="gdk_pixbuf_format_get_name ()"><code class="function">gdk_pixbuf_format_get_name()</code></a> 来获取所支持的
图像格式的完整列表。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>image_type</code></em> :</span></p></td>
<td>将要加载的图像格式的名称。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>return location for an allocated <a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>一个新的 pixbuf 装载器(loader).</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-new-with-mime-type"></a><h3>gdk_pixbuf_loader_new_with_mime_type ()</h3>
<pre class="programlisting"><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="returnvalue">GdkPixbufLoader</span></a> *     gdk_pixbuf_loader_new_with_mime_type
                                                        (<em class="parameter"><code>const <span class="type">char</span> *mime_type</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
创建一个新的 pixbuf loader 对象来解析图像数据，该数据将始终被假设为 
<em class="parameter"><code>mime_type</code></em> mime类型的图像数据，而不是自动判断图像格式。当如果希望当加载一个不
能通过查看数据来可靠确定的文件格式的文件时，如果该文件不是期望的mime类型便引
发一个错误时会有用，手工强制指定一个mime类型时也有用。
</p>
<p>
支持的mime类型列表依赖于安装了哪些图像加载器(image loader)，但典型的 
"image/png", "image/jpeg", "image/gif", 
"image/tiff" 和 "image/x-xpixmap" 都是可支持的mime类型。可
以通过为 <a class="link" href="gdk-pixbuf-Module-Interface.html#gdk-pixbuf-get-formats" title="gdk_pixbuf_get_formats ()"><code class="function">gdk_pixbuf_get_formats()</code></a> 所返回的每个 <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="type">GdkPixbufFormat</span></a> 结构调用 
<a class="link" href="gdk-pixbuf-Module-Interface.html#gdk-pixbuf-format-get-mime-types" title="gdk_pixbuf_format_get_mime_types ()"><code class="function">gdk_pixbuf_format_get_mime_types()</code></a> 来获取所支持的mime类型的完整列表。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mime_type</code></em> :</span></p></td>
<td>将加载的mime类型</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>return location for an allocated <a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>一个新创建的 pixbuf loader。 Since: 2.4</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-get-format"></a><h3>gdk_pixbuf_loader_get_format ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="returnvalue">GdkPixbufFormat</span></a> *   gdk_pixbuf_loader_get_format        (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>);</pre>
<p>
得到关于当前加载的图像文件的格式的可用信息。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>一个 pixbuf 装载器</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>一个 <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="struct GdkPixbufFormat"><span class="type">GdkPixbufFormat</span></a> 或者 <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. 返回值为 GdkPixbuf所有且不需要被释
放。</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-write"></a><h3>gdk_pixbuf_loader_write ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_pixbuf_loader_write             (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#guchar"><span class="type">guchar</span></a> *buf</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> count</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
这将使一个 pixbuf loader 解析一个图像接下来的 <em class="parameter"><code>count</code></em> 个字节数据。如果数据加载
成功则返回 <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>，而当错误发生时返回 <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>。在后一种情况中，这个 loader 将被
关闭，且不再接受任何写操作。如果返回 <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>， <em class="parameter"><code>error</code></em> 将被设置，可能的错误为 
<a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> 或 <a href="../glib/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a>。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>一个 pixbuf 装载器</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td>Pointer to image data. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=count]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
<td>缓冲区 <em class="parameter"><code>buf</code></em> 的字节长度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>返回错误的位置</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>成功返回 <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>，当这个 loader 不能正确解析这个缓冲区(buffer)时
返回 <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-set-size"></a><h3>gdk_pixbuf_loader_set_size ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_pixbuf_loader_set_size          (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>);</pre>
<p>
Causes the image to be scaled while it is loaded. The desired
image size can be determined relative to the original size of
the image by calling <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-set-size" title="gdk_pixbuf_loader_set_size ()"><code class="function">gdk_pixbuf_loader_set_size()</code></a> from a
signal handler for the ::size-prepared signal.
</p>
<p>
Attempts to set the desired image size  are ignored after the 
emission of the ::size-prepared signal.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>一个 pixbuf 装载器</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>被加载图像的要求宽度</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>被加载图像的要求高度.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-get-pixbuf"></a><h3>gdk_pixbuf_loader_get_pixbuf ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> *           gdk_pixbuf_loader_get_pixbuf      (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>);</pre>
<p>
Queries the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> that a pixbuf loader is currently creating.
In general it only makes sense to call this function after the
"area-prepared" signal has been emitted by the loader; this means
that enough data has been read to know the size of the image that
will be allocated.  If the loader has not received enough data via
<a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()"><code class="function">gdk_pixbuf_loader_write()</code></a>, then this function returns <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.  The
returned pixbuf will be the same in all future calls to the loader,
so simply calling <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-ref"><code class="function">g_object_ref()</code></a> should be sufficient to continue
using it.  Additionally, if the loader is an animation, it will
return the "static image" of the animation
(see <a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#gdk-pixbuf-animation-get-static-image" title="gdk_pixbuf_animation_get_static_image ()"><code class="function">gdk_pixbuf_animation_get_static_image()</code></a>).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>一个 pixbuf 装载器</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>这个 loader 创建的 <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> ，
如果还没有读取可以创建图像缓冲区(image buffer)的足够的数据时则返回 <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>。. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-get-animation"></a><h3>gdk_pixbuf_loader_get_animation ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#GdkPixbufAnimation"><span class="returnvalue">GdkPixbufAnimation</span></a> *  gdk_pixbuf_loader_get_animation   (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>);</pre>
<p>
查询一个 pixbuf loader 当前创建的 <a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a> 。只有当这个 loader 发
出 "area_prepared" 信号后调用该函数才有意义。如果这个 loader 还没
有接收到足够的数据时(还没有发出 "area_prepared" 信号)则返回 <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>一个 pixbuf 装载器</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>这个 loader 加载的 <a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#GdkPixbufAnimation"><span class="type">GdkPixbufAnimation</span></a>，
但还没有读取到足够的数据来确定其信息的时候则返回 <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>。. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-loader-close"></a><h3>gdk_pixbuf_loader_close ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_pixbuf_loader_close             (<em class="parameter"><code><a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
通知一个 pixbuf loader 不再有使用 <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-write" title="gdk_pixbuf_loader_write ()"><code class="function">gdk_pixbuf_loader_write()</code></a> 进行的写操作发
生，以便其可以释放其内部的加载结构。可以尝试解析任何没有解析的数据；如果剩余
的数据是不完整或损坏的，则回引起一个错误。如果返回 <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>，<em class="parameter"><code>error</code></em> 将被设置，
可能的错误为 <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> 或 <a href="../glib/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> 。如果只想取消一个 loader 而
不是要结束它，可以给 <em class="parameter"><code>error</code></em> 传递一个 <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>。
</p>
<p>
Remember that this does not unref the loader, so if you plan not to
use it anymore, please <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> it.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>一个 pixbuf 装载器</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>返回<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>对象的位置，或者返回 <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> 以忽略错误. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>如果当前所有写入的数据可以通过 update_area 信号成功解吸则返回
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>。</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1">
<a name="GdkPixbufLoader.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GdkPixbufLoader-area-prepared"></a><h3>The <code class="literal">"area-prepared"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader,
                                                        <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>         user_data)      : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
该信号当 pixbuf 加载器被按期望的尺寸分配了 pixbuf 时被发出。当该信号发出后，
程序可以调用 <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-get-pixbuf" title="gdk_pixbuf_loader_get_pixbuf ()"><code class="function">gdk_pixbuf_loader_get_pixbuf()</code></a> 来取得被部分加载了的 pixbuf。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>接收到信号的对象。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbufLoader-area-updated"></a><h3>The <code class="literal">"area-updated"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader,
                                                        <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>             x,
                                                        <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>             y,
                                                        <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>             width,
                                                        <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>             height,
                                                        <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>         user_data)      : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
该信号当被加载的图像的一个重要区域被更新时发出。一般来说这意味着读取了一个完
整的 scanline，但也可能是一个不同的区域。 。应用程序可以使用该信号来得知什么
时候需要重画正在加载的图像的一个区域。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>接收到信号的对象。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>被更新的区域的左上角的 X 值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>被更新的区域的左上角的 Y 值。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>更新区域的宽度</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>更新区域的高度</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbufLoader-closed"></a><h3>The <code class="literal">"closed"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader,
                                                        <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>         user_data)      : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
该信号当 <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-close" title="gdk_pixbuf_loader_close ()"><code class="function">gdk_pixbuf_loader_close()</code></a> 被调用时发出。该信号可以被应用程序的不同部
分用来接收一个图像加载器被代码关闭的通知。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>接收到信号的对象。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbufLoader-size-prepared"></a><h3>The <code class="literal">"size-prepared"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GdkPixbufLoader.html" title="GdkPixbuf加载器(GdkPixbufLoader)"><span class="type">GdkPixbufLoader</span></a> *loader,
                                                        <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>             width,
                                                        <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>             height,
                                                        <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>         user_data)      : <a href="../gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
该信号当 pixbuf 加载器收到最初的能够计算出其将要创建的图像大小的时候被发出。
应用程序可以调用 <a class="link" href="GdkPixbufLoader.html#gdk-pixbuf-loader-set-size" title="gdk_pixbuf_loader_set_size ()"><code class="function">gdk_pixbuf_loader_set_size()</code></a> 来相应这个信号以设置该图像应该
被缩放的期望尺寸。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
<td>接收到信号的对象。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
<td>图像的原始宽度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
<td>图像的原始高度。</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1">
<a name="GdkPixbufLoader.see-also"></a><h2>See Also</h2>
gdk_pixbuf_new_from_file(), <a class="link" href="gdk-pixbuf-%E5%8A%A8%E7%94%BB.html#gdk-pixbuf-animation-new-from-file" title="gdk_pixbuf_animation_new_from_file"><code class="function">gdk_pixbuf_animation_new_from_file()</code></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>